home *** CD-ROM | disk | FTP | other *** search
- // SSoundSystem.cpp: Implementierung der Klasse SSoundSystem.
- //
- //////////////////////////////////////////////////////////////////////
-
- #include "stdafx.h"
- #include "SSoundSystem.h"
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[]=__FILE__;
- #define new DEBUG_NEW
- #endif
-
- //////////////////////////////////////////////////////////////////////
- // Konstruktion/Destruktion
- //////////////////////////////////////////////////////////////////////
-
- SSoundSystem::SSoundSystem()
- {
- inited = false;
- }
-
- SSoundSystem::~SSoundSystem()
- {
- if (!inited)
- {
- return;
- }
-
- for (int i = 0; i < NUM_SAMPLES; i += 1)
- {
- BASS_SampleFree(samples[i]);
- }
-
- //BASS System runterfahren
-
- BASS_Free();
- BASS_Stop();
- }
-
- void SSoundSystem::init(HWND hWnd)
- {
- BASS_Init(
- -1,
- 44100,
- NULL,
- hWnd);
-
- BASS_Start();
-
- //******************
- //WAV Samples laden
- //******************
-
- /*samples[SAMPLE_BAUM] = BASS_SampleLoad(false,"Data/Baum.wav",
- 0,0,1,BASS_SAMPLE_OVER_VOL);*/
- samples[SAMPLE_RELEASE] = BASS_SampleLoad(false,"Data/Absetzen.wav",
- 0,0,1,BASS_SAMPLE_OVER_VOL);
-
-
- //******************
- //MP3s laden
- //******************
-
- streams[STREAM_RUDI] = BASS_StreamCreateFile(false,
- "Data\\Rudi.mp3",
- 0,
- 0,
- NULL);
-
- streams[STREAM_BELLS] = BASS_StreamCreateFile(false,
- "Data\\Jingle Bells.mp3",
- 0,
- 0,
- NULL);
-
-
-
-
- //BASS_StreamPlay(music,false,BASS_SAMPLE_LOOP);
-
- inited = true;
- }
-
- void SSoundSystem::playMusic(int which,bool looped)
- {
- if (which < 0 || which > 2)
- {
- return;
- }
-
- BASS_StreamPlay(streams[which],true,(looped ? BASS_SAMPLE_LOOP:0));
- }
-
- void SSoundSystem::stopMusic(int which)
- {
- if (which < 0 || which > 1)
- {
- return;
- }
-
- BASS_Stop();
- BASS_Start();
- }
-
- void SSoundSystem::playSample(int which)
- {
- if (which < 0 || which > NUM_SAMPLES)
- {
- return;
- }
-
- BASS_SamplePlay(samples[which]);
- }
-